<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <meta name="wap-font-scale" content="no">  <!--解决UC字体忽然变大-->
    <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1">
    
        <?php if(!empty($page["title"])): ?><title><?php echo ($page["title"]); ?></title>
            <?php else: ?>
            <title><?php echo ($setting["sitename"]); ?></title><?php endif; ?>
    
    <?php if(!empty($page["keywords"])): ?><meta name="keywords" content="<?php echo ($page["keywords"]); ?>"/>
        <?php else: ?>
        <meta name="keywords" content="<?php echo ($setting["keywords"]); ?>"/><?php endif; ?>
    <?php if(!empty($page["description"])): ?><meta property="description" name="description" content="<?php echo ($page["description"]); ?>"/>
        <?php else: ?>
        <meta property="description" name="description" content="<?php echo ($setting["description"]); ?>"/><?php endif; ?>

    
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--bootstrap组件--><link rel="stylesheet" href="/Public/bootstrap/bootstrap.min.css" ><script src="/Public/bootstrap/jquery.min.js" ></script><script src="/Public/bootstrap/popper.min.js"></script><script src="/Public/bootstrap/bootstrap.min.js"></script><!--awesome字体--><link href="/Public/bootstrap/font/css/font-awesome.min.css" rel="stylesheet"><!--bootstrap-dialog--><script src="/Public/bootstrap/bootstrap.dialog.js"></script><!--拖拽--><!--<script type="text/javascript" src="/Public/Plugs/jq/jquery-ui.min.js"></script>--><!--文件上传--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/uploadify/uploadify.css"><script type="text/javascript" src="/Public/Plugs/uploadify/jquery.uploadify.min.js"></script>--><!--滚动条--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.css"/><script type="text/javascript" src="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.js"></script>--><!--颜色选择器--><link rel="stylesheet" type="text/css" href="/Public/Plugs/spectrum/spectrum.css"><script type="text/javascript" src="/Public/Plugs/spectrum/spectrum.js"></script><!--弹出框--><script type="text/javascript" src="/Public/Plugs/jq/jquery-dialog.js"></script><!--新日历控件,来源  http://blog.csdn.net/binyao02123202/article/details/42066035--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/calendar/cxcalendar.css"/><script type="text/javascript" src="/Public/Plugs/calendar/calendar.js"></script>--><!--日期选择器插件datetimepicker--><link rel="stylesheet" href="/Public/Plugs/flatpickr/flatpickr.min.css"><script type="text/javascript" src="/Public/Plugs/flatpickr/flatpickr.js"></script><script type="text/javascript" src="/Public/Plugs/flatpickr/zh.js?v=3"></script><!--文件上传-插件地址：https://github.com/danielm/uploader--><script src="/Public/Plugs/dmuploader/jquery.dm-uploader.js"></script><!--ueditor--><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.config.js"></script><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.all.js"></script><link rel="stylesheet" type="text/css" href="/Public/Plugs/ueditor/third-party/video-js/video-js.css"><script type="text/javascript" src="/Public/Plugs/ueditor/third-party/video-js/video.js"></script><!--app--><link rel="stylesheet" type="text/css" href="/Public/Admin/css/style.css"/><script type="text/javascript" src="/Public/Admin/js/common_admin.js"></script>
    
</head>
<body>

<div class="g-page-in">
        <div class="clearfix">        <div class="float-left">            <div class="u-breadcrumb">                <a class="back" href="javascript:window.location.reload()" ><span class="fa fa-repeat"></span> 刷新</a>                <span class="name">导航设置</span>            </div>        </div>        <div class="float-right">            <a href="#" role="button" class="btn btn-primary btn-sm" onclick="return alert_win('根目录',0);"><i class="fa fa-plus"></i> 新增顶级导航</a>        </div>    </div>    <div class="h10"></div>	<table class="table table-bb">		<tr>            <th width="30">                <div class="custom-control custom-checkbox">                    <input type="checkbox" class="custom-control-input checkbox-all" id="checkbox-0">                    <label class="custom-control-label"  for="checkbox-0"></label>                </div>            </th>			<th width="60">ID</th>			<th>名称 / 英文</th>			<th width="360">URL路径</th>			<th>排序</th>			<th>是否显示</th>			<th>操作</th>		</tr>		<?php if(is_array($catelist)): $i = 0; $__LIST__ = $catelist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="tr_<?php echo ($vo["id"]); ?>">                <td>                    <div class="custom-control custom-checkbox">                        <input type="checkbox" class="custom-control-input checkbox-item" id="checkbox-<?php echo ($vo["id"]); ?>" value="<?php echo ($vo["id"]); ?>" data-print-url="<?php echo U('GoodsOrderPrint/print_view',array('id'=>$vo['id']));?>" data-id="<?php echo ($vo["id"]); ?>">                        <label class="custom-control-label"  for="checkbox-<?php echo ($vo["id"]); ?>"></label>                    </div>                </td>				<td><?php echo ($vo["id"]); ?></td>				<td><?php if(!empty($vo["name_cn"])): echo ($vo["pre"]); echo ($vo["name_cn"]); endif; if(!empty($vo["name_en"])): ?>&nbsp;/&nbsp;<?php echo ($vo["name_en"]); endif; ?></td>				<td onclick="return show_url_input(this);">					<span><?php echo ($vo["url"]); ?></span>					<input class="text text_max dis_none" type="text" data-old-url="<?php echo ($vo["url"]); ?>" value="<?php echo ($vo["url"]); ?>" onblur="return ajax_update_url(this,'<?php echo ($vo["id"]); ?>');" />				</td>				<td>                    <div class="form-inline">                        <?php echo ($vo["pre"]); ?>&nbsp;<input class="form-control form-control-sm w-40" type="text" name="sort" value="<?php echo ($vo["sort"]); ?>" old-sort="<?php echo ($vo["sort"]); ?>" data-id="<?php echo ($vo["id"]); ?>" sort-id="<?php echo ($vo["id"]); ?>" />&nbsp;                        <a class="blue" href="#" onclick="return update_sort(<?php echo ($vo["id"]); ?>,this)">更新</a>                    </div>				</td>				<td>					<?php switch($vo["is_show"]): case "0": ?><span class="badge badge-secondary">关闭</span><?php break;?>						<?php case "1": ?><span class="badge badge-success">显示</span><?php break; endswitch;?>				</td>				<td>                    <a class="btn btn-sm btn-outline-secondary" href="<?php echo U('Nav/edit',array('id'=>$vo['id']));?>" role="button"><i class="fa fa-edit"></i> 编辑</a>                    <div class="btn-group" role="group">                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">                            更多                        </button>                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">                            <a class="dropdown-item" href="#" onclick="return alert_win('<?php echo ($vo["name_cn"]); ?>',<?php echo ($vo["id"]); ?>)"><i class="fa fa-plus"></i> 子分类</a>                            <?php if(($vo["is_show"]) == "1"): ?><a class="dropdown-item" href="#" onclick="return unshow_one('NavCate',<?php echo ($vo["id"]); ?>)"><i class="fa fa-eye-slash"></i> 关闭</a>                                <?php else: ?>                                <a class="dropdown-item" href="#" onclick="return show_one('NavCate',<?php echo ($vo["id"]); ?>)"><i class="fa fa-eye"></i> 显示</a><?php endif; ?>                            <a class="dropdown-item" href="#" onclick="return cate_delete('<?php echo ($vo["id"]); ?>')"><i class="fa fa-trash"></i> 删除</a>                        </div>                    </div>				</td>			</tr><?php endforeach; endif; else: echo "" ;endif; ?>	</table>    <div>        <button type="button" class="btn btn-secondary btn-sm" onclick="return update_sort();"><i class="fa fa-sort"></i> 排序</button>        <button type="button" class="btn btn-secondary btn-sm" onclick="return show_all('NavCate');"><i class="fa fa-eye"></i> 显示</button>        <button type="button" class="btn btn-secondary btn-sm" onclick="return unshow_all('NavCate');"><i class="fa fa-eye-slash"></i> 关闭</button>    </div><!--新增分类--><div id="as" style="display: none;">    <form action="<?php echo U('Nav/add');?>" method="post">        <div class="form-group">            <label>父级</label>            <span class="text-muted pl-2 js-pid"></span>        </div>        <input name="id" type="hidden" value="">        <div class="form-group">            <label><span class="text-danger">* </span>名称（中文）</label>            <input type="text" class="form-control" name="name_cn" placeholder="分类名称">            <small class="form-text text-muted">1-50个字符</small>        </div>        <div class="form-group">            <label>English</label>            <input type="text" class="form-control" name="name_en" placeholder="英文名称">            <small class="form-text text-muted">1-50个字符，选填</small>        </div>        <div class="form-group">            <label>url</label>            <input type="text" class="form-control" name="url" placeholder="url">            <small class="form-text text-muted"></small>        </div>        <div class="form-group">            <label>打开方式</label>            <select class="form-control" name="target">                <option value="_self" selected>_self</option>                <option value="_blank">_blank</option>            </select>            <small class="form-text text-muted">_self当前窗口，_blank新窗口</small>        </div>        <div class="form-group">            <label>是否显示</label>            <div>                <div class="custom-control custom-radio custom-control-inline">                    <input type="radio" id="is_show1" name="is_show" class="custom-control-input" value="1" checked>                    <label class="custom-control-label" for="is_show1">显示</label>                </div>                <div class="custom-control custom-radio custom-control-inline">                    <input type="radio" id="is_show2" name="is_show" class="custom-control-input" value="0">                    <label class="custom-control-label" for="is_show2">关闭</label>                </div>            </div>        </div>        <div class="h10"></div>        <div class="text-center">            <button type="submit" class="btn btn-primary">新增</button>        </div>    </form></div><script>    //弹出创建分类窗口    function alert_win(name,id){        $('.js-pid').text(name);        $('input[name=id]').val(id);        $boot.win({id:'#as','title':'新增分类'});        return false;    }	//显示网址输入框	function show_url_input(obj){		$(obj).find('span').hide();		$(obj).find('input').show().focus();		return false;	}	//更新网址	function ajax_update_url(obj,$id){		var old_url = $(obj).attr('data-old-url');		var this_url = $(obj).val();		if(this_url != old_url){			$.ajax({				type:"post",				url:"<?php echo U('Nav/ajax_update_url');?>",				data:{id:$id,url:this_url},				success:function(data){					if(data.status){						$(obj).parent().find('span').text(this_url).show();						$(obj).parent().find('input').attr({'data-old-url':this_url,'value':this_url}).hide();					}				}			});		}else{			$(obj).parent().find('span').show();			$(obj).parent().find('input').hide();		}	}	//删除分类提示	function cate_delete($id)	{		$boot.confirm({text:'确定删除此导航？',title:'删除导航'},function(){			$.ajax({				type:"post",				url:"<?php echo U('Nav/ajax_del_cate');?>",				data:{id:$id},				success:function(data){					if(data['status']){						$boot.success({text:"删除成功！"},function(){							for(i=0;i<data.ids.length;i++){								$(".tr_"+data['ids'][i]).remove();							}						});					}else{						$boot.error({text:data['error']});					}				}			});		});		return false;	}    //更新单条排序    function update_sort_one($id,obj){        var old_sort = $(obj).prev().attr('old-sort');        var now_sort = $(obj).prev().val();        if(old_sort == now_sort){            $boot.warn({text:"请先调整排序值！"});            return false;        }else{            $.ajax({                type:"post",                url:"<?php echo U('Nav/ajax_setsort');?>",                data:{id:$id,sort:now_sort},                success:function(data){                    if(data['status']){                        $boot.success({text:"更新成功！"},function(){                            window.location = window.location;                        });                    }                }            });        }        return false;    }    function update_sort(){        $last_id = $("input[name=sort]").last().attr('data-id');        $("input[name=sort]").each(function(){            var $id = $(this).attr('data-id'),$sort = $(this).val(),$old_sort = $(this).attr('old_sort');            if($old_sort!=$sort){                $.ajax({                    type:"post",                    url:"<?php echo U('Nav/ajax_setsort');?>",                    data:{id:$id,sort:$sort},                    success:function(data){                        if(data['status'] && $id == $last_id){                            $boot.success({text:"更新成功！",delay:1200},function(){                                window.location = window.location;                            });                        }                    }                });            }        });        return false;    }</script>
</div>

<script type="text/javascript" src="/Public/Admin/js/my.js"></script>
</body>
</html>